<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/lib/jquery-3.4.1/jquery-3.4.1.min.js" charset="utf-8"></script>
    <script src="/js/lay-module/echarts/echarts.min.js" charset="utf-8"></script>
</head>

<body>
    <div id="main" style="width: 600px; height:400px;"></div>

</body>
<script>
    var chartDom = document.getElementById('main');
    var myChart = echarts.init(chartDom);
    var option;
    var array = [];
    var data1 = [];
    var data2 = [];



    debugger
    $.ajax({
        url: "http://localhost:8080/medical/health/echarBar",
        data: "",
        type: "post",

        success: function (result1) {
            var result = result1.data.sexBar;
            console.log(result)
            for (var i in result) {

                data1.push(result[i].health_sex);
                data2.push(result[i].count);
                var map = {};


                map.name = result[i].health_sex;
                map.value = result[i].count;
                array[i] = map;

            }
            console.log(array + "array")
            // debugger
            option = {
                tooltip: {
                    trigger: 'item'
                },
                legend: {
                    top: '5%',
                    left: 'center'
                },
                series: [
                    {
                        name: 'Access From',
                        type: 'pie',
                        radius: ['40%', '70%'],
                        avoidLabelOverlap: false,
                        itemStyle: {
                            borderRadius: 10,
                            borderColor: '#fff',
                            borderWidth: 2
                        },
                        label: {
                            show: false,
                            position: 'center'
                        },
                        emphasis: {
                            label: {
                                show: true,
                                fontSize: '40',
                                fontWeight: 'bold'
                            }
                        },
                        labelLine: {
                            show: false
                        },
                        data: array,
                    }
                ]
            };
            myChart.setOption(option);
        },
        dataType: "json"
    })



</script>

</html>